<!DOCTYPE html>
<html lang="en" style="height: 100%;">
<head>
    <meta charset="UTF-8">
    <title>商品订单</title>
    <style>
        .hander_zx{font-size:18px}.conten{background:#fff;margin-top:10px}.conten ul{overflow:hidden;padding:0;margin:0;border-bottom:1px solid #e5e5e5}.conten_floet li{float:left;list-style:none;line-height:45px;text-align:center;width:100px;cursor:pointer;color:#212121}.active{color:#14d882!important;border-bottom:3px solid #14d882}.push_fx li{float:left;font-size:14px;list-style:none;width:11%;text-align:center;background:#f8f8f8;line-height:45px;color:#1f1f1f}.lick_push li{float:left;font-size:14px;width:11%;text-align:center;line-height:45px;list-style:none;color:#616161}.lick_push li:last-child{color:#14d882!important}.lick_push li:last-child span:nth-child(1){margin-right:5px}.lick_push li:last-child span{cursor:pointer}.w_node{width:16%!important}
    </style>
    <link rel="stylesheet" href="../css/paging.css">
</head>
<body style="height:100%;overflow-x: hidden">
<!--//hander-->
<div class="hander_zx" style="margin-top:5px;padding-left: 10px;">商品订单</div>
<!--内容-->
<div class="conten">
    <ul class="conten_floet">
        <li class="active" id="qb">全部</li>
        <li id="dfk">待付款</li>
        <li id="dfh">待发货</li>
        <li id="dsh">待收货</li>
        <li id="wc">已完成</li>
    </ul>
    <div>
        <ul class="push_fx" style="background:#F8F8F8;width: 100%;">
            <li class="w_node">订单号</li>
            <li class="w_node">下单时间</li>
            <li>购买用户</li>
            <li>订单总额</li>
            <li>付款方式</li>
            <li>订单状态</li>
            <li>渠道来源</li>
            <li>操作</li>
        </ul>
    </div>
    <!--//数据展示列表-->
    <div id="fx_put"></div>
    <!--分页列表-->
    <div class="box" id="box" style="display:none;"></div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/2.1.1-rc2/jquery.min.js"></script>
<script src="../js/paging.min.js"></script>
<script>
    'use strict';$(function(){function query(){$.ajax({type:'get',url:'/wf/selectallordernum',dataType:'json',contentType:"application/json",success:function success(data){c(data,null,'/wf/selectallorder')}})}query();function push_code(code){$.ajax({type:'post',url:'/wf/selectallorderbystatus',dataType:'json',contentType:"application/json",data:JSON.stringify({status:code}),success:function success(data){c(data,code,'/wf/selectallorderbystatus')}})}$("#qb").on('click',function(){$(this).siblings().removeClass("active");$(this).addClass("active");query()});$("#dfk").on('click',function(){$(this).siblings().removeClass("active");$(this).addClass("active");push_code(1)});$("#dfh").on('click',function(){$(this).siblings().removeClass("active");$(this).addClass("active");push_code(2)});$("#dsh").on('click',function(){$(this).siblings().removeClass("active");$(this).addClass("active");push_code(3)});$("#wc").on('click',function(){$(this).siblings().removeClass("active");$(this).addClass("active");push_code(5)});function c(data,to,url_to){if(typeof data.data==='number'&&data.data>0){$("#box").css("display","block")}else{$("#box").css("display","none")}var total=Math.ceil(data.data/24);$('#box').paging({initPageNo:1,totalPages:total,totalCount:'合计'+data.data+'条数据',slideSpeed:600,jump:true,callback:function callback(page){$.ajax({type:'post',url:url_to,dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({currentPage:page,pageCount:24,status:to}),success:function success(data){var html='';for(var i=0;i<data.data.length;i++){html+='\n                                    <ul class="lick_push">\n                                        <li class="w_node">'+data.data[i].order_sn+'</li>\n                                        <li class="w_node">'+formatDate(data.data[i].addtime)+'</li>\n                                        <li>'+(data.data[i].nickName==""?"/":data.data[i].nickName==null?"":data.data[i].nickName)+'</li>\n                                        <li>'+data.data[i].price+'</li>\n                                        <li>'+(data.data[i].bankType==null?"暂未支付":data.data[i].bankType=="overpay"?"余额支付":data.data[i].bankType=="weChat"?"微信支付":"新浪支付")+'</li>\n                                        <li class="zt">'+(data.data[i].status==0?"已取消":data.data[i].status==1?"待付款":data.data[i].status==2?"待发货":data.data[i].status==3?"待收货":data.data[i].status==5?"交易完成":data.data[i].status==6?"交易关闭":data.data[i].status==7?"退货":"")+'</li>\n                                        <li>\u53CB\u7267\u5B9D\u5B98\u65B9</li>\n                                        <li>\n                                            <span class="comm_fh" data-name="'+data.data[i].getuser+'" data-order_sn="'+data.data[i].order_sn+'" style="'+(data.data[i].status==2?"display:inline-block":"display:none")+'">\u53D1\u8D27</span>\n                                            <span class="comm_ck" data-id="'+data.data[i].id+'" data-address_id="'+data.data[i].address_id+'">\u67E5\u770B</span>\n                                        </li>\n                                    </ul>\n                                    '}$("#fx_put").html(html)}})}})}function formatDate(now){var now=new Date(now);var year=now.getFullYear();var month=now.getMonth()+1;var date=now.getDate();var hour=now.getHours();var minute=now.getMinutes();var second=now.getSeconds();return year+"-"+fixZero(month,2)+"-"+fixZero(date,2)+" "+fixZero(hour,2)+":"+fixZero(minute,2)+":"+fixZero(second,2)}function fixZero(num,length){var str=""+num;var len=str.length;var s="";for(var i=length;i-->len;){s+="0"}return s+str}var kd_name="";$("#fx_put").on('click','.comm_ck',function(){$.ajax({type:'post',url:'/wf/selectoneorderaddress',dataType:'json',contentType:"application/json",data:JSON.stringify({id:$(this).attr("data-id"),address_id:$(this).attr("data-address_id")}),success:function success(data){var htmlcode='';$('.nickName',window.parent.document).text(data.nickName);$('.sp_number',window.parent.document).text(data.wbOrder.order_sn);$('.sp_yhj',window.parent.document).text("￥"+data.offer_num);$('.sp_yh',window.parent.document).text("￥"+data.wbOrder.post_remark);$('.sp_zw',window.parent.document).text(data.wbOrder.price_h);$('.sp_sf',window.parent.document).text(data.wbOrder.price);$(".sp_name",window.parent.document).text(data.wbAddress.getuser);$(".sp_phone",window.parent.document).text(data.wbAddress.phone);$(".sp_yb",window.parent.document).text(data.wbAddress.postal_code);$(".sp_s_s_q",window.parent.document).text(data.wbAddress.shen+"-"+data.wbAddress.shi+"-"+data.wbAddress.qu);$(".sp_dz",window.parent.document).text(data.wbAddress.address);if(data.wbTrading==null){push("暂无时间记录","暂无流水号","暂未支付","暂未支付",data.wbOrder.status)}else{push(formatDate(data.wbTrading.act_time),data.wbTrading.serialNumber,data.wbOrder.price,data.wbTrading.banktype=="overpay"?"余额支付":data.wbTrading.banktype=="weChat"?"微信支付":"新浪支付",data.wbOrder.status)}if(data.wbOrder.kuaidi_name==null){kd("暂无记录","暂无收货人","暂无快递","暂无单号",data.wbOrder.status)}else{kd(formatDate(data.wbOrder.shipments_time),data.wbAddress.getuser,kd_name,data.wbOrder.kuaidi_num,data.wbOrder.status)}for(var i=0;i<data.wbOrder.orderItemList.length;i++){htmlcode+='\n                            <ul class="fx_hash">\n                                <li>\u5546\u54C1\u540D\u79F0 : '+data.wbOrder.orderItemList[i].wbSaleProduct.name+'</li>\n                                <li>\u5546\u54C1\u5355\u4EF7 : '+data.wbOrder.orderItemList[i].wbSaleProduct.price+'</li>\n                                <li>\u5546\u54C1\u6570\u91CF : '+data.wbOrder.orderItemList[i].pro_count+'</li>\n                            </ul>\n\n                            '}$('#fh_jl',window.parent.document).html(htmlcode);switch(data.wbOrder.kuaidi_name){case null:kd_name="暂未快递";break;case"ems":kd_name="邮政EMS";break;case"yunda":kd_name="韵达快递";break;case"shunfeng":kd_name="顺丰快递";break;case"shentong":kd_name="申通快递";break;case"yuantong":kd_name="圆通快递";break;case"zhongtong":kd_name="中通快递";break;case"huitongkuaidi":kd_name="百世汇通";break;case"tiantian":kd_name="天天快递";break}}});$('#popup',window.parent.document).css("display","block")});function push(a,b,c,d,f){$(".st_sj",window.parent.document).text(a);$(".st_dh",window.parent.document).text(b);$(".st_jq",window.parent.document).text(c);$(".st_fk",window.parent.document).text(d);$(".st_zt",window.parent.document).text(f==0?"已取消":f==1?"待付款":f==2?"待发货":f==3?"待收货":f==5?"交易完成":f==6?"交易关闭":f==7?"退货":"")}function kd(a,b,c,d,f){$(".kd_sj",window.parent.document).text(a);$(".fx_xm",window.parent.document).text(b);$(".kd_push",window.parent.document).text(c);$(".kd_dh",window.parent.document).text(d);$(".kd_zt",window.parent.document).text(f==0?"已取消":f==1?"待付款":f==2?"待发货":f==3?"待收货":f==5?"交易完成":f==6?"交易关闭":f==7?"退货":"")}var do_inut="";$("#fx_put").on('click','.comm_fh',function(){$('#pst',window.parent.document).css("display","block");$('#toli',window.parent.document).css("display","block");$('#Deliver_gooDs',window.parent.document).css("display","block");$('#dd_bh',window.parent.document).text("订单["+$(this).attr("data-order_sn")+"]发货操作");$('.iter_num',window.parent.document).text($(this).attr("data-order_sn"));$('.name_push',window.parent.document).text($(this).attr("data-name"))});$(".fx_qd",window.parent.document).on('click',function(){do_inut=$('#kd_dh_push',window.parent.document).val();if(do_inut.length<=0){alert("单号不能为空");return}$.ajax({type:'post',url:"/wf/updateshipments",dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({id:$('.iter_num',window.parent.document).text(),kuaidi_name:$('#testSelect option:selected',window.parent.document).val(),kuaidi_num:do_inut}),success:function success(data){if(data.code=="00"){$("#Deliver_gooDs",window.parent.document).css("display","none");location.reload();return}if(data.code!="00"){alert(data.data);return}}})})});
</script>
</html>